name: 'Close stale issues and PRs'
on:
  schedule:
    - cron: '0 0 * * *'

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          start-date: '2021-10-19T00:00:00Z' # only start labelling issues from today
          stale-issue-label: 'lifecycle/stale'
          stale-pr-label: 'lifecycle/stale'
          stale-issue-message: |
            Marking this issue as stale due to 30 days of inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 7 days it will automatically be closed. Maintainers can also remove the `lifecycle/stale` label.
            If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!
          stale-pr-message: |
            Marking this pull request as stale due to 14 days of inactivity. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next 7 days it will automatically be closed. Maintainers can also remove the `lifecycle/stale` label.
            If this pull request was automatically closed and you feel this pull request should be reopened, we encourage creating a new pull request linking back to this one for added context. Thank you!
          close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
          close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity.'
          days-before-issue-stale: 30
          days-before-pr-stale: 14
          days-before-issue-close: 7
          days-before-pr-close: 7
          any-of-issue-labels: 'triage/needs-information,triage/not-reproducible,triage/unresolved,workflow/pending-contributor-response,workflow/pending-op-response'
          exempt-pr-labels: 'workflow/pending-upstream-library,workflow/pending-public-documentation,workflow/pending-cloudflare-response,workflow/pending-maintainer-response'
          exempt-draft-pr: true
